package edu.cuit.campus.web.converter;

import edu.cuit.campus.enums.Job;
import org.springframework.core.convert.converter.Converter;

/**
 * 职位类型转换器(将字符串转换成Job)
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/8/19 14:55
 */
public class JobConverter implements Converter<String, Job> {
    @Override
    public Job convert(String source) {
        System.out.println("类型转换器：" + source);
        return switch (source) {
            case "业务员" -> Job.CLERK;
            case "分析员" -> Job.ANALYST;
            case "销售员" -> Job.SALESMAN;
            case "AI" -> Job.SEARCHER;
            case "经理" -> Job.MANAGER;
            default -> null;
        };
    }
}
